package stardust.product.ai.recognition.image.text;


import java.awt.Image;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorConvertOp;
import javax.imageio.ImageIO;


public class PreprocessingImage
{
  
  public static void main(String[] args)
  {
    ImageIO.write(PreprocessingImage.process(ImageIO.read("")), formatName, output)
  }

  public static BufferedImage process(BufferedImage src)
  {
    ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);  
    ColorConvertOp op = new ColorConvertOp(cs, null);  
    return op.filter(src, null);  
  }
  
}
